<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>
<body>
    <div id='app'>
        {{msg}}
        <ul>
            <li v-for="(item,index) in pro" :key="item.id">
                <input type="checkbox" v-model="item.chk" @change="aa()">
                <span>品牌：{{item.proName}}</span>
                <span>单价：{{item.price}}元</span>
                <span>件数：{{item.num}}件</span>
            </li>
        </ul>
        <p>总价：{{total}}元</p>
    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue',
                total: 0,
                pro: [{
                    id: 1,
                    proName: 'nick',
                    price: 50,
                    chk: false,
                    num: 2
                },{
                    id: 2,
                    proName: 'anta',
                    price: 60,
                    chk: false,
                    num: 3
                },{
                    id: 3,
                    proName: 'adidas',
                    price: 70,
                    chk: false,
                    num: 4
                },{
                    id: 4,
                    proName: 'step',
                    price: 80,
                    chk: false,
                    num: 5
                },{
                    id: 5,
                    proName: '361',
                    price: 90,
                    chk: false,
                    num: 6
                }]
            },
            methods: {
                aa() {
                    this.total = 0;
                    this.pro.forEach(item => {
                       if(item.chk === true) {
                           this.total = this.total + parseFloat(item.price) * parseFloat(item.num);
                       }
                   })
                }
            }
        });
    </script>
</body>
</html>